#coding:utf-8

class Solution:
    def strStr(self, haystack: str, needle: str) -> int:
        if needle == '' :
            return 0
        if len(haystack) < len(needle):
            return -1
        i = 0
        while i+len(needle) <= len(haystack):
            if haystack[i:i+len(needle)] == needle:
                return i
            i += 1
        return -1
        


if __name__ == '__main__':
    solu = Solution()
    print(solu.strStr('a','a'))